package StudentManager;

import StudentManager.Student;

import java.util.ArrayList;
import java.util.Scanner;

public class StudentManagerDemo {//学生管理 案例

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //规定当前集合 装学生
        ArrayList<Student> studentList = new ArrayList();
        while (true){
            System.out.println("选择(1、录入;)");
            System.out.println("(0、退出;)");
            int choice = scanner.nextInt();
            if (choice == 1){
                System.out.println("请输入学生姓名:");
                String name = scanner.next();
                System.out.println("请输入学生的年龄:");
                int age = scanner.nextInt();

                Student student = new Student();
                student.setName(name);1

                student.setAge(age);
                studentList.add(student);
            } else if (choice == 0) {

                for (int i = 0; i < studentList.size(); i++) {
                    Student student = studentList.get(i);
                    System.out.println(student.getName() + "---" + student.getAge());
                }

//                for (Student s : studentList) {
//                    System.out.println(s);
//                }
                break;

            }
        }






//        System.out.println(studentList);


    }


}

